export default {
  // Global page headers: https://go.nuxtjs.dev/config-head
  head: {
    title: '阳光沙滩-领劵联盟商城',
    htmlAttrs: {
      lang: 'en'
    },
    meta: [
      { charset: 'utf-8' },
      { name: 'viewport', content: 'width=device-width, initial-scale=1' },
      { name: 'format-detection', content: 'telephone=no' },
      { hid: 'description', name: 'description', content: '这个页面描述' },
      { hid: 'keywords', name: 'keywords', content: '领劵，优惠，淘宝' },
    ],
    link: [
      { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
    ],
    script: [
      {
        src: "https://cdn.sunofbeaches.com/qrcodejs/qrcode.min.js",
      }
    ]
  },

  router: {
    middleware: 'auth',
    extendRoutes: function (routes, resolve) {
      routes.push({
        name: 'root',
        path: '/index',
        component: resolve(__dirname, 'pages/index.vue')
      })
    }
  },

  // loading: {
  //   color: '#399',
  //   height: '3px',
  // },
  loading: '~/components/loading.vue',

  // Global CSS: https://go.nuxtjs.dev/config-css
  css: [
    'assets/css/transition.css',
    'element-ui/lib/theme-chalk/index.css',
    {
      src: 'assets/css/main.scss',
      lang: 'scss'
    }
  ],

  // Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
  plugins: [
    '~/plugins/router.js',
    {
      src: '~/plugins/axios.js',
      ssr: true  // 服务端渲染
    },
    {
      src: '~/plugins/elementui.js',
      ssr: true
    },
    {
      src: '~/plugins/vue-infinite-scroll.js',
      ssr: false
    }
  ],

  // Auto import components: https://go.nuxtjs.dev/config-components
  components: true,

  // Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules
  buildModules: [
  ],

  // Modules: https://go.nuxtjs.dev/config-modules
  modules: [
    '@nuxtjs/axios',
    "@nuxtjs/proxy"
  ],

  axios: {
    proxy: true,
  },

  proxy: {
    '/api/': {
      target: 'https://api.sunofbeaches.com/shop',
      pathRewrite: {'^/api': ''}
    }
  },

  // Build Configuration: https://go.nuxtjs.dev/config-build
  build: {
  }
}
